package com.shihb.chapter05matchcase

/**
 * Description:匹配list
 *
 * @author shihb
 * @date 2020/9/30 14:45
 */
object Demo03MatchList {
  def main(args: Array[String]): Unit = {
    for(list<- Array(List(0),List(1,0),List(0,0,0),List(1,0,0))){
      val res=list match{
        case 0::Nil => "0"
        case x::y::Nil=> (x,y)
        case 0::tail=>"0..."
        case _ =>"something else"
      }
      println(res)
    }


  }

}
